#pragma once

// VideoEditorCtrl.h : Declaration of the CVideoEditorCtrl ActiveX Control class.


// CVideoEditorCtrl : See VideoEditorCtrl.cpp for implementation.

#include ".\Classes\Player.h"

class CVideoEditorCtrl : public COleControl
{
	DECLARE_DYNCREATE(CVideoEditorCtrl)

// Constructor
public:
	CVideoEditorCtrl();

// Overrides
public:
	virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
	virtual void DoPropExchange(CPropExchange* pPX);
	virtual void OnResetState();

// Implementation
protected:
	~CVideoEditorCtrl();

	DECLARE_OLECREATE_EX(CVideoEditorCtrl)    // Class factory and guid
	DECLARE_OLETYPELIB(CVideoEditorCtrl)      // GetTypeInfo
	DECLARE_PROPPAGEIDS(CVideoEditorCtrl)     // Property page IDs
	DECLARE_OLECTLTYPE(CVideoEditorCtrl)		// Type name and misc status

// Message maps
	DECLARE_MESSAGE_MAP()

// Dispatch maps
	DECLARE_DISPATCH_MAP()

	afx_msg void AboutBox();

// Event maps
	DECLARE_EVENT_MAP()

// Dispatch and event IDs
public:
	enum {
		dispidGetCurrentPlayTime = 8L,
		dispidSnapshotBitmap = 7L,
		dispidStop = 6L,
		dispidPause = 5L,
		dispidSetCurrentPosition = 4L,
		eventidPlayAbort = 2L,
		eventidPlayComplete = 1L,
		dispidClose = 3L,
		dispidPlay = 2L,
		dispidOpen = 1L
	};

	void OnRecvPlayerMessage(MSG_TYPE msg_type);

private:
	Player m_player;
protected:
	LONG Open(LPCTSTR fileName, LONG hWndDisplay, LONG hWndNotify);
	void Play(void);
	void Close(void);

	void PlayComplete(void)
	{
		FireEvent(eventidPlayComplete, EVENT_PARAM(VTS_NONE));
	}

	void PlayAbort(void)
	{
		FireEvent(eventidPlayAbort, EVENT_PARAM(VTS_NONE));
	}
	void SetCurrentPosition(LONG inPosition);
	void Pause(void);
	void Stop(void);
	LONG SnapshotBitmap(LPCTSTR outFile);
	DOUBLE GetCurrentPlayTime(void);
};

